"""删除"""
import pymysql

db = None
try:
    db = pymysql.connect(
        host='localhost',
        port=3307,
        user='root',
        password='123456',
        database='myschools',
        charset='utf8',
        autocommit=True

    )
    # 建立游标
    cursor = db.cursor()
    cursor.execute("delete from students where id=5")
    #     提交
    db.commit()
except Exception as e:
    print("异常", e)
finally:
    if db:
        db.close()
